package com.jeff.studyclient;

import com.jeff.studyclient.ui.LoginDialog;
import com.jeff.studyclient.ui.SplashScreen;
import com.jeff.studyclient.vo.LoginResult;

/**
 * Hello world!
 *
 */
public class Application {
    private static LoginDialog loginDialog;

    public Application() {
        init();
    }
    
    public static void main(String[] args) {
        new Application();
    }

    private static void init() {
        SplashScreen mainPan = new SplashScreen();
        mainPan.setVisible(false);
        
        try {
            Runtime.getRuntime().addShutdownHook(new ShutdownHook());
            loginDialog = new LoginDialog();
            loginDialog.setVisible(true);
            loginDialog.toFront();
        } catch (Throwable t) {
            System.out.println("App cannot start due to: " + t.getMessage());
            System.exit(-1);
        }
        
    }
    
    private static class ShutdownHook extends Thread {

        @Override
        public void run() {
            //TODO: some cleanup task
            
            System.out.println("App Demo Dashboard shutdown....");
        }
        
    }
    
    public static void startup(LoginResult result) {
        System.out.println("Started!~");
    }

}
